#include <iostream>
/*
Write a class with three overloaded virtual functions. 
Inherit a new class from this and override one of the functions. 

Create an object of your derived class. 
Can you call all the base class functions through the derived-class object? 

Upcast the address of the object to the base. 
Can you call all three functions through the base? 

Remove the overridden definition in the derived class. 
Now can you call all the base class functions through the derived-class object?
*/
using namespace std;

class Base {
public:
	virtual void A() {
		cout << "the A() of Base is called." << endl;
	}
	virtual void A(int a) {
		cout << "the A(int a) of Base is called." << endl;
	}
	virtual void A(int a, int b) {
		cout << "the A(int a, int b) of Base is called." << endl;
	}
};

class Son1 : public Base {
public:
	void A() {
		cout << "the A() of Son is called." << endl;
	}
};

class Son2 : public Base {
	
};

int main(int argc, char *argv[]) {
	// call all the base class functions through the derived-class object:
	Son1 s1;
	s1.Base::A();
	s1.Base::A(1);
	s1.Base::A(1,2);
	cout << "======================" << endl;
	
	//call all three functions through the base
	Base* b1 = new Son1();
	b1->Base::A();
	b1->Base::A(1);
	b1->Base::A(1,2);
	cout << "======================" << endl;
	
	//Remove the overridden definition
	Son2 s2;
	s2.A();
	s2.A(1);
	s2.A(1,2);
}